#include "./thread_try/thread.h"
#include "schedule.h"
#include "itrupt_timer.h"
#include "sigmask.h"
#include "task.h"

void* task1(void * param);
void* task2(void *param);
void* task3(void *param);

int main()
{
    //create task ... one main loop
    
    /*create interrupt thread */

    //Uart_thread();

	mask_signal_init();
    /* init timer */
    init_timer();

	task_create("test1", 1024 * 1, task1, 1);
	task_create("test2", 1024 * 1, task2, 1);
	task_create("test3", 1024 * 1, task3, 1);

    start_schedule();

	while(1)
	{
		sleep(2);
	}
    //sig_wait();

    //pthread_join(current_thread);

    return 0;
}





#if 1
void* task1(void * param)
{
    while(1)
    {
        printf("task1---------- %x\n", pthread_self());
        trap_stat_check();
        sleep(2);
    }
}

void* task2(void *param)
{
    //printf("task2 entry--------- %d\n", pthread_self());
   // thread_data * thread = (thread_data*)param;
    

    while(1)
    {
        printf("task2---------- %x\n", pthread_self());
        trap_stat_check();
		sleep(3);
    }
}

void* task3(void* param)
{
	while(1)
	{
		printf("task3---------- %x\n", pthread_self());
		trap_stat_check();
		sleep(4);
	}
}

#endif
